home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Rice_CMS / gopher24 / gopsrvls.$rexx < prev    next >
Encoding:
Text File  |  1993-01-25  |  14.7 KB  |  187 lines

  1. /*                                                                      00010000
  2.  *        Name: GOPSRVLS REXX                                           00020000
  3.  *              list a file or directory, feeding to the next stage     00030000
  4.  *      Author: Rick Troth, Rice University, Information Systems        00040000
  5.  *        Date: 1993-Jan-15, 19                                         00050000
  6.  */                                                                     00060000
  7.                                                                         00070000
  8. /*                                                                      00080000
  9.  *      Copyright 1993 Richard M. Troth.   This software was developed  00090000
  10.  *      with resources provided by Rice University and is intended      00100000
  11.  *      to serve Rice's user community.   Rice has benefitted greatly   00110000
  12.  *      from the free distribution of software,  therefore distribution 00120000
  13.  *      of unmodified copies of this material is not restricted.        00130000
  14.  *      You may change your own copy as needed.   Neither Rice          00140000
  15.  *      University nor any of its employees or students shall be held   00150000
  16.  *      liable for damages resulting from the use of this software.     00160000
  17.  */                                                                     00170000
  18.                                                                         00180000
  19. Parse Source . . arg0 .                                                 00190000
  20. Parse Upper Arg fn ft fm . '(' . ')' .                                  00200000
  21. If fn = "" Then fn = '*'                                                00210000
  22. If ft = "" Then ft = '*'                                                00220000
  23. If ft = "FILELIST" & Index(fn,'*') = 0 Then ft = "*"                    00230000
  24. If fm = "" Then fm = '*'                                                00240000
  25.                                                                         00250000
  26. Parse Arg string                                                        00260000
  27. Say arg0 || ':' string                                                  00270000
  28.                                                                         00280000
  29. Address "COMMAND" 'GLOBALV SELECT GOPHERD GET MENU NICK CLIENT'         00290000
  30.                                                                         00300000
  31. If menu ^= "" Then Do                                                   00310000
  32.                                                                         00320000
  33.                                                                         00330000
  34.     Address "CMS" 'STATE' menu 'NAMES *'                                00340000
  35.     If rc = 0 Then Do                                                   00350000
  36.                                                                         00360000
  37.         If nick = "" Then nick = "*"                                    00370000
  38.                                                                         00380000
  39.         'CALLPIPE COMMAND NAMEFIND :NICK' nick ':AUTH :PIPE' ,          00390000
  40.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00400000
  41.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00410000
  42.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00420000
  43.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00430000
  44.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00440000
  45.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00450000
  46.                 '| VAR PIPE'                                            00460000
  47.                                                                         00470000
  48.         If rc = 32 Then                                                 00480000
  49.         'CALLPIPE COMMAND NAMEFIND :FN' fn ':FT' ft ':AUTH :PIPE' ,     00490000
  50.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00500000
  51.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00510000
  52.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00520000
  53.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00530000
  54.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00540000
  55.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00550000
  56.                 '| VAR PIPE'                                            00560000
  57.                                                                         00570000
  58.         If rc = 32 Then                                                 00580000
  59.         'CALLPIPE COMMAND NAMEFIND :NICK * :AUTH :PIPE' ,               00590000
  60.                 '(FILE' menu '| VAR AUTH | DROP' ,                      00600000
  61.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00610000
  62.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00620000
  63.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00630000
  64.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            00640000
  65.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            00650000
  66.                 '| VAR PIPE'                                            00660000
  67.                                                                         00670000
  68.         If rc = 0 Then Do                                               00680000
  69.                                                                         00690000
  70.             /*  if auth non-blank  */                                   00700000
  71.             If ^gopsrvau(client,auth) Then Do                           00710000
  72.                 /*  "access restricted"  */                             00720000
  73.                 'CALLPIPE COMMAND XMITMSG 2380' ,                       00730000
  74.                     '(CALLER GOP ERRMSG' ,                              00740000
  75.                         '| SPEC /- / 1 1-* NEXT | *:'                   00750000
  76.                 Exit rc                                                 00760000
  77.                 End  /*  If  ..  Do  */                                 00770000
  78.                                                                         00780000
  79.             If pipe ^= "" Then Do                                       00790000
  80.                 'CALLPIPE' pipe '| *:'                                  00800000
  81.                 Exit rc                                                 00810000
  82.                 End  /*  If  ..  Do  */                                 00820000
  83.                                                                         00830000
  84.             End  /*  If  ..  Do  */                                     00840000
  85.                                                                         00850000
  86.         End  /*  If  ..  Do  */                                         00860000
  87.                                                                         00870000
  88.     End  /*  If  ..  Do  */                                             00880000
  89.                                                                         00890000
  90. If ft = '*' Then Do                                                     00900000
  91.                                                                         00910000
  92.     Address "CMS" 'STATE' fn 'NAMES *'                                  00920000
  93.     If rc = 0 Then Do                                                   00930000
  94.                                                                         00940000
  95.         'CALLPIPE COMMAND NAMEFIND :NICK . :AUTH :PIPE' ,               00950000
  96.                 '(FILE' fn '| VAR AUTH | DROP' ,                        00960000
  97.         '| CHANGE' '00'x || '&0' || '00'x || nick || '00'x ,            00970000
  98.         '| CHANGE' '00'x || '&1' || '00'x ||  fn  || '00'x ,            00980000
  99.         '| CHANGE' '00'x || '&2' || '00'x ||  ft  || '00'x ,            00990000
  100.         '| CHANGE' '00'x || '&3' || '00'x ||  fm  || '00'x ,            01000000
  101.         '| CHANGE' '00'x || '&4' || '00'x || menu || '00'x ,            01010000
  102.                 '| VAR PIPE'                                            01020000
  103.                                                                         01030000
  104.         If rc = 0 Then Do                                               01040000
  105.                                                                         01050000
  106.             /*  if auth non-blank  */                                   01060000
  107.             If ^gopsrvau(client,auth) Then Do                           01070000
  108.                 /*  "access restricted"  */                             01080000
  109.                 'CALLPIPE COMMAND XMITMSG 2380' ,                       01090000
  110.                     '(CALLER GOP ERRMSG' ,                              01100000
  111.                         '| SPEC /- / 1 1-* NEXT | *:'                   01110000
  112.                 Exit rc                                                 01120000
  113.                 End  /*  If  ..  Do  */                                 01130000
  114.                                                                         01140000
  115.             If pipe ^= "" Then Do                                       01150000
  116.                 menu = fn                                               01160000
  117.                 Address "COMMAND" 'GLOBALV SELECT GOPHERD PUT MENU'     01170000
  118.                 'CALLPIPE' pipe '| *:'                                  01180000
  119.                 Exit rc                                                 01190000
  120.                 End  /*  If  ..  Do  */                                 01200000
  121.                                                                         01210000
  122.             End  /*  If  ..  Do  */                                     01220000
  123.                                                                         01230000
  124.         End  /*  If  ..  Do  */                                         01240000
  125.                                                                         01250000
  126.     End  /*  If  ..  Do  */                                             01260000
  127.                                                                         01270000
  128. If Index(fn ft, '*') = 0 Then Do                                        01280000
  129.     Address "CMS" 'STATE' fn ft fm                                      01290000
  130.     If rc = 0 Then Do                                                   01300000
  131.         'CALLPIPE <' fn ft fm '| *:'                                    01310000
  132.         Exit rc                                                         01320000
  133.         End                                                             01330000
  134.     Exit rc                                                             01340000
  135.     End                                                                 01350000
  136.                                                                         01360000
  137. If Index(fn,'*') = 0 & ft = '*' Then Do                                 01370000
  138.                                                                         01380000
  139.     Address "COMMAND" 'GLOBALV SELECT GOPHERD SET MENU' fn              01390000
  140.                                                                         01400000
  141.     Address "CMS" 'STATE' fn 'FILELIST' fm                              01410000
  142.     If  rc = 0  Then Do     /*  menu is a FILELIST  */                  01420000
  143.         'CALLPIPE <' fn 'FILELIST' fm '| *:'                            01430000
  144.         Exit rc                                                         01440000
  145.         End  /*  If  ..  Do  */                                         01450000
  146.                                                                         01460000
  147.     If fm = '*' | fm = "" Then fm = 'A'                                 01470000
  148.     'CALLPIPE COMMAND ACCESS +' || fm || '.' || fn fm                   01480000
  149.     If rc = 0 Then Do                                                   01490000
  150.         /*  menu is an SFS sub-directory  */                            01500000
  151.         'CALLPIPE' arg0 '* *' fm '| *:'                                 01510000
  152.         lrc = rc                                                        01520000
  153.         'CALLPIPE COMMAND ACCESS -' || fm fm                            01530000
  154.         Exit lrc                                                        01540000
  155.         End  /*  If  ..  Do  */                                         01550000
  156.     If rc = 28 | rc = 100 Then Exit rc                                  01560000
  157.     End                                                                 01570000
  158.                                                                         01580000
  159. /*  shortcut for GOPSRVRP on LISTFILE not FILELIST  */                  01590000
  160. 'OUTPUT' " "                                                            01600000
  161. If rc ^= 0 Then Exit rc * (rc ^= 12)                                    01610000
  162.                                                                         01620000
  163. /*  list all files in this directory  */                                01630000
  164. 'ADDPIPE COMMAND LISTFILE' fn ft fm '(ALLFILE ALLOC NOHEADER | *.INPUT:'01640000
  165. If rc ^= 0 Then Do                                                      01650000
  166.     'CALLPIPE COMMAND LISTFILE' fn ft fm '(NOHEADER | *:'               01660000
  167.     Exit rc                                                             01670000
  168.     End  /*  If  ..  Do  */                                             01680000
  169.                                                                         01690000
  170. /*  give SFS directories a filetype '*'  */                             01700000
  171. Do Forever                                                              01710000
  172.                                                                         01720000
  173.     'PEEKTO RECORD'                                                     01730000
  174.     If rc ^= 0 Then Leave                                               01740000
  175.                                                                         01750000
  176.     Parse Var record fn ft fm .                                         01760000
  177.     If fm = "DIR" Then 'OUTPUT' "     " fn '*' ft                       01770000
  178.                   Else 'OUTPUT' "     " fn ft fm                        01780000
  179.                                                                         01790000
  180.     'READTO'                                                            01800000
  181.     If rc ^= 0 Then Leave                                               01810000
  182.                                                                         01820000
  183.     End  /*  If  ..  Do  Forever  */                                    01830000
  184.                                                                         01840000
  185. Exit rc * (rc ^= 12)                                                    01850000
  186.                                                                         01860000
  187.